<template>
  <section class="shop-tab-control">
    <div
      v-for="(item, index) in titles"
      :key="index"
      @click="handleFollowingAreaShow(index)"
    >
      <span class="text" :class="{ active: currentIndex === index }">{{ item }}</span>
    </div>
  </section>
</template>

<script>
export default {
  data() {
    return {
      titles: ["商品", "评价"],
      currentIndex: 0,
    };
  },
  methods: {
    handleFollowingAreaShow(index) {
      this.currentIndex = index;
      this.$bus.$emit('handleControlSwitch',index)
    },
  },
};
</script>
<style lang="less" scoped>
.shop-tab-control {
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  font-size: 15px;
  .text {
    padding: 0 5px;
  }
  .active {
    padding: 5px;
    border-bottom: 2px solid #3190e8;
    color: #3190e8;
  }
}
</style>